'''
Created on 08/04/2011

@author: eric
'''

import connect.out as conn


class Wiki(object):
    '''
    Class Abstraction of a web page
    '''
    
    _sitestring = "http://en.wikipedia.org/wiki/"
    _defaultpage = "Special:Random"
    _pagecontent =""
    
    def _setpagecontent(self, text):
        self._pagecontent = text
        
    def setsitestring(self, site):
        self._sitestring = site;
    
    def setdefaultpage(self, page):
        self._defaultpage = page
        
    def getdefaultpage(self):
        return self._defaultpage
    
    def getsitestring(self):
        return self._sitestring
    
    def urltostring(self):
        return (self.getsitestring() + self.getdefaultpage())
    
    def getpagecontent(self):
        return 
    
    def refresh(self):
        self._setpagecontent(conn.Get(self.urltostring()))
        
    def __init__(self, page=_defaultpage, site=_sitestring):
        '''
        @param this: self reference
        @param site: URL string to connect and fetch
        '''

        self.setsitestring(site)
        self.setdefaultpage(page)
        self._setpagecontent(conn.Get.page(self.urltostring()))
        